const {
  override,
  addWebpackAlias,
  addWebpackModuleRule
} = require('customize-cra')

const path = require('path')

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  paths: function (paths) {
    paths.appBuild = resolve('./build')
    return paths
  },
  webpack: override(
    addWebpackAlias({
      '@': resolve('src')
    }),
    addWebpackModuleRule({
      test: /\.css$/,
      exclude: /(node_modules|global)/,
      use: [
          {loader: "style-loader"},
          {
              loader: "css-loader",
              options: {
                  modules:{
                      localIdentName: "[local]-[hash:5]"
                  }
              }
          }
      ],
    })
  )
}